<template>
  <div id="app">
    <!--<Cart></Cart>
    <van-button type="primary" @click="getData">主要按钮</van-button>
    <img :src="pic" alt="" />-->
    <!--路由出口，可以看作是一个变量，随着url变化，变成不同的组件-->
    <router-view />
  </div>
</template>

<script>
//1.导入外部文件
import Cart from "./components/day06Cart.vue";
export default {
  name: "App",
  data() {
    return {
      //专辑封面
      pic: "",
    };
  },
  methods: {
    //获取数据
    getData() {
      //1.发请求 Promise
      this.$http
        .get(
          "https://api.imjad.cn/cloudmusic/?type=detail&id=28012031&br=128000"
        )
        //2.成功的回调
        .then((res) => {
          this.pic = res.data.songs[0].al.picUrl;
        })
        //3.失败的回调
        .catch((err) => {
          console.log(err);
        });
    },
  },
  components: {
    Cart: Cart,
  },
  //钩子函数
  created() {
    this.getData();
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /*text-align: center;
  color: #2c3e50;
  margin-top: 60px;*/
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
</style>

<!--<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item>1</van-swipe-item>
      <van-swipe-item>2</van-swipe-item>
      <van-swipe-item>3</van-swipe-item>
      <van-swipe-item>4</van-swipe-item>
    </van-swipe>
    3.当作标签使用
    <!--<comA name="you are beautful" artist="vutal" rank="1"></comA>
    <comA name="1" artist="vutal" rank="2"></comA>
    <comA name="real" artist="vutal" rank="3"></comA>
    <comA
      v-for="(song, index) in hotSangs"
      v-bind:key="index"
      :name="song.name"
      :artist="song.artist"
      :rank="index + 1"
      :rate="5 - index"
    ></comA>
    
    
    //注册组件
  components: {
    //第一个是名字，第二个是内容
    shop: shop,
  },
    
    -->